using Microsoft.SqlServer.Management.Sdk.Sfc;
using Microsoft.SqlServer.Management.Smo;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Microsoft.SqlServer.Management.SqlManagerUI.Scripting
{
using Server = Microsoft.SqlServer.Management.Smo.Server;
	internal class ScriptSource
	{
		private List<Urn> objectsToScript = new List<Urn>();

		private IEnumerable<Urn> createDependencies = new Urn[0];

		private IEnumerable<Urn> dropDependencies = new Urn[0];

		public ReadOnlyCollection<Urn> ObjectsToScript
		{
			get
			{
				return new ReadOnlyCollection<Urn>(this.objectsToScript);
			}
		}

		public IEnumerable<Urn> CreateDependencies
		{
			get
			{
				return this.createDependencies;
			}
		}

		public IEnumerable<Urn> DropDependencies
		{
			get
			{
				return this.dropDependencies;
			}
		}

		public ScriptSource(IEnumerable<Urn> objectsToScript, IEnumerable<Urn> createDependencies, IEnumerable<Urn> dropDependencies)
		{
			if (objectsToScript != null)
			{
				this.objectsToScript.AddRange(objectsToScript);
			}
			if (createDependencies != null)
			{
				this.createDependencies = createDependencies;
			}
			if (dropDependencies != null)
			{
				this.dropDependencies = dropDependencies;
			}
		}

		public static ScriptSource CreateScriptSource(Server server, Urn[] urns, DiscoveryTasks discoverDependencies, bool isDataOnly)
		{
			ScriptSourceFactory scriptSourceFactory = new ScriptSourceFactory();
			return scriptSourceFactory.CreateScriptSource(server, urns, discoverDependencies, isDataOnly);
		}
	}
}
